import * as d3 from 'd3'

/**
 * 只要执行本函数，便能为你生成一个'2023/07/04 下午14:23:27 星期二'这种格式的时间
 * @param {Date} oDate 时间对象
 */
export function createTime(oDate){
    const dict ={
        Monday: "星期一",
        Tuesday: "星期二",
        Wednesday: "星期三",
        Thursday: "星期四",
        Friday: "星期五",
        Saturday: "星期六",
        Sunday: "星期日",
    };
    const formatWeek = d3.timeFormat("%A");
    const format = d3.timeFormat("%Y/%m/%d %p%H:%M:%S");

    const englishWeek = formatWeek(oDate)
    const chineseWeek = dict[englishWeek];

    const timeStr = format(oDate).replace("AM","上午").replace("PM","下午")

    return `${timeStr} ${chineseWeek}`
}